<template>
	<view class="index" :style="{'height':windowHeight}">
		<clothes></clothes>
		<view class="binding">
			<view class="binding-li">
				<view class="li-txt">限速值</view>
				<view class="li-input">
					<input placeholder="请输入限速值" v-model="limitSpeed" type="number" />
					<!-- <uni-easyinput errorMessage v-model="value" focus placeholder="请输入内容" @input="input"></uni-easyinput> -->
				</view>
			</view>
			<view class="binding-li">
				<view class="li-txt">限速开始时间</view>
				<view>
					<uni-datetime-picker v-model="startTime" :border="false" />
				</view>
			</view>
			<view class="binding-li">
				<view class="li-txt">限速结束时间</view>
				<view>
					<uni-datetime-picker v-model="endTime" :border="false" />
				</view>
			</view>
			<view class="bindings-btn" @click="submit">提交</view>
		</view>
	</view>
</template>
<script>
	export default {
		components: {

		},
		data() {
			return {
				limitSpeed:null,
				startTime: '',
				endTime: '',
			}
		},
		onLoad() {
			this.GaoDu() //判断手机高度
		},
		onShow() {

		},
		computed: {

		},
		methods: {
			// 提交
			submit(){
				if(this.limitSpeed == null){
					uni.showToast({
						duration: 1000,
						title:'限速值不能为空',
						icon: 'none',
					})
					return
				}
				if(this.limitSpeed == ''){
					uni.showToast({
						duration: 1000,
						title:'开始时间不能为空',
						icon: 'none',
					})
					return
				}
				if(this.limitSpeed == ''){
					uni.showToast({
						duration: 1000,
						title:'结束时间不能为空',
						icon: 'none',
					})
					return
				}
				const value = uni.getStorageSync('iponeInfo');
				this.$REQ(this.$api.jhLockNetwork, {
					sn: value.deviceNo,
					limitSpeed:this.limitSpeed,
					startTime:this.startTime,
					endTime:this.endTime,
				}, 'POST').then(res => {
					console.log(res)
					uni.showToast({
						duration: 1000,
						title: res.data.msg,
						icon: 'none',
					})
				}).catch(err => {
					console.log(err)
					uni.showToast({
						duration: 1000,
						title: err.data.msg,
						icon: 'none',
					})
				})
			},
			
			// 判断手机高度
			GaoDu() {
				console.log('12356')
				// 判断手机页面的高度
				uni.getSystemInfo({

					success: (res) => {
						this.windowHeight = res.windowHeight + "px";
					}
				})
			},
		}
	}
</script>

<style scoped lang="less">
	.binding-li {
		display: flex;
		flex-wrap: nowrap;
		justify-content: space-between;
		border-bottom: 1rpx solid #eee;
		background: #fff;
		padding: 25rpx;
		margin-bottom:10rpx;margin-top:10rpx;
		border-radius: 10rpx;
	}

	.binding {
		padding: 25rpx;
	}

	.li-txt {
		font-size: 28rpx;
		line-height: 65rpx;
	}

	.li-icon {
		width: 35rpx;
		height: 35rpx;
	}

	image {
		width: 100%;
		height: 100%;
	}
.bindings-btn{
		background: #6C74F1;
		width: 100%;
		margin: auto;
		height: 80rpx;
		border-radius: 100rpx;
		text-align: center;
		line-height: 80rpx;
		color: #fff;
		margin-top: 60rpx
	}
	.li-input{
		
	}
	.li-input input{
		font-size: 28rpx;
		text-align: right;
	}
	
</style>